home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / fgets.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.5 KB  |  67 lines

  1.  
  2.  
  3.  
  4. GETS(3)             MINTLIB LIBRARY FUNCTIONS             GETS(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        gets, fgets - get a string from a stream
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <stdio.h>
  12.  
  13.        char *gets(char *s);
  14.  
  15.        char *fgets(char *s, int n, FILE *stream);
  16.  
  17. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  18.        gets  reads  characters  from  the  standard input stream,
  19.        stdin, into the array pointed to by s,  until  a  new-line
  20.        character  is  read or an end-of-file condition is encoun-
  21.        tered. The new-line character is discarded and the  string
  22.        is terminated with a null character.
  23.  
  24.        fgets  reads character from the file stream into the array
  25.        pointed to by s, until n-1 characters are read, or a  new-
  26.        line character is read and transferred to s, or an end-of-
  27.        file condition is encountered. The string is  then  termi-
  28.        nated with a null character.
  29.  
  30. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  31.        f✓fe✓er✓rr✓ro✓or✓r(✓(3✓3)✓),✓, f✓fo✓op✓pe✓en✓n(✓(3✓3)✓),✓, f✓fr✓re✓ea✓ad✓d(✓(3✓3)✓),✓, g✓ge✓et✓tc✓c(✓(3✓3)✓),✓, s✓sc✓ca✓an✓nf✓f(✓(3✓3)✓)
  32.  
  33. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  34.        If  end-of-file is encountered and no characters have been
  35.        read, no characters  are  transferred  to  s  and  a  NULL
  36.        pointer  is returned. If a read error occurs, such as try-
  37.        ing to use these functions on a file  that  has  not  been
  38.        opened  for reading, a NULL pointer is returned. Otherwise
  39.        s is returned.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.